import request from '@/utils/request'
import { hex_md5 } from '@/utils/md5'

export function loginByUsername(username, password) {
  const data = {
    name: username,
    password: hex_md5(password)
  }
  return request({
    url: '/mg/login/verify',
    method: 'post',
    params: data
  })
}

export function logout() {
  return request({
    url: '/login/logout',
    method: 'post'
  })
}

export function getUserInfo(token) {
  return request({
    url: '/mg/login/getUser',
    method: 'get',
    params: { token }
  })
}

